<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
     
    <html xmlns="http://www.w3.org/1999/xhtml">
    
<head>    
    <script type="text/javascript" src="http://csdnimg.cn/pubfooter/js/tracking.js" charset="utf-8"></script>  

    <script type="text/javascript">
        var protocol = window.location.protocol;
        document.write('<script type="text/javascript" src="' + protocol + '//csdnimg.cn/pubfooter/js/repoAddr2.js?v=' + Math.random() + '"></' + 'script>');
    </script>


    <script id="allmobilize" charset="utf-8" src="http://a.yunshipei.com/46aae4d1e2371e4aa769798941cef698/allmobilize.min.js"></script>
 <meta http-equiv="Cache-Control" content="no-siteapp" /><link rel="alternate" media="handheld" href="#" />

    <title>深入理解Java Class文件格式（六） - 张纪刚的博客
        - 博客频道 - CSDN.NET</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="description" content="经过前几篇文章， 终于将常量池介绍完了， 之所以花这么大的功夫介绍常量池， 是因为对于理解class文件格式，常量池是必须要了解的， 因为class文件中其他地方，大量引用了常量池中的数据项。 &#160;对于还不了解常量池的读者， 如果想要深入了解class文件格式， 或者想继续读这篇博客和本专栏以后的博客， 那么我建议先把我前面的几篇博客读一下，把常量池的结构熟悉一下， 对于理解后面的内容很有帮助。" />
    <script src="http://static.blog.csdn.net/scripts/jquery.js" type="text/javascript"></script>
    <script type="text/javascript" src="http://static.blog.csdn.net/scripts/ad.js?v=1.1"></script>
        <!--new top-->
               <link rel="stylesheet" href="http://static.csdn.net/public/common/toolbar/css/index.css">        <!--new top-->

    <link rel="Stylesheet" type="text/css" href="http://static.blog.csdn.net/skin/light_blue/css/style.css?v=1.1" />
    <link id="RSSLink" title="RSS" type="application/rss+xml" rel="alternate" href="/brave2211/rss/list" />
    <link rel="shortcut icon" href="http://csdnimg.cn/public/favicon.ico" />
    <link type="text/css" rel="stylesheet" href="http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/default.css" />
 


</head>
<body>
    
   
      <!--new top-->
    <script id="toolbar-tpl-scriptId" fixed="true" prod="blog" skin="black" src="http://static.csdn.net/public/common/toolbar/js/html.js" type="text/javascript"></script>
     <!--new top-->
    <div id="container">
        <div id="header">
    <div class="header">
        <div id="blog_title">
            <h2>
                <a href="http://blog.csdn.net/zhangjg_blog">张纪刚的博客</a></h2>
            <h3>专注Java和Android，喜欢Linux，Scala，大数据等技术</h3>
            <div class="clear">
            </div>
        </div>
        <div class="clear">
        </div>
    </div>
</div>
<div id="navigator">
    <div class="navigator_bg">
    </div>
    <div class="navigator">
        <ul>
                <li id="btnContents"><a href="http://blog.csdn.net/zhangjg_blog?viewmode=contents"><span onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_mulu'])">
                    <img src="http://static.blog.csdn.net/images/ico_list.gif">目录视图</span></a></li>
                <li id="btnView"><a href="http://blog.csdn.net/zhangjg_blog?viewmode=list"><span onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_zhaiyao'])">
                    <img src="http://static.blog.csdn.net/images/ico_summary.gif">摘要视图</span></a></li>
                <li id="btnRss"><a href="http://blog.csdn.net/zhangjg_blog/rss/list"><span onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_RSS'])">
                    <img src="http://static.blog.csdn.net/images/ico_rss.gif">订阅</span></a></li>                

            </ul>
    </div>
</div>
<script type="text/javascript">
    var username = "brave2211";
    var _blogger = username;
    var blog_address = "http://blog.csdn.net/zhangjg_blog";
    var static_host = "http://static.blog.csdn.net";
    var currentUserName = "";  
</script>

        <div id="body">
            <div id="main">
                <div class="main">
                        <div class="ad_class">
<div class="notice tracking-ad" data-mod='popu_3' > 


<a href="http://edu.csdn.net/course/detail/330">
<font color=blue>从零开始掌握iOS8开发技术（Swift版）</font></a>

&nbsp;&nbsp;&nbsp;&nbsp;

<a href="http://blog.csdn.net/blogdevteam/article/details/42918959">
<font color=red>那些年我们追过的Wrox精品红皮计算机图书
</font></a>
&nbsp;&nbsp;&nbsp;&nbsp;
<a href="http://blog.csdn.net/csdnedu/article/details/43148831">
<font color=blue>CSDN学院--学习礼包大派送
</font></a>
&nbsp;&nbsp;&nbsp;&nbsp;

<a href="http://job.csdn.net/event/mobdev.html ">
<font color=red>CSDN JOB带你坐飞机回家过年
</font></a>


</div>                        </div>
                        

  
<link href="http://static.blog.csdn.net/css/comment1.css" type="text/css" rel="stylesheet" />
<link href="http://static.blog.csdn.net/css/style1.css" type="text/css" rel="stylesheet" />
<script language='JavaScript' type='text/javascript' src='http://download.csdn.net/js/jquery.cookie.js'></script>
<script type="text/javascript" src="http://csdnimg.cn/rabbit/search-service/main.js"></script>
  <script type="text/ecmascript">
      window.quickReplyflag = true;
    </script>
<div id="article_details" class="details">
    <div class="article_title">   
         <span class="ico ico_type_Original"></span>


    <h1>
        <span class="link_title"><a href="/zhangjg_blog/article/details/21888943">
        深入理解Java Class文件格式（六）
        </a></span>
    </h1>
</div>

    <div class="article_manage">
        <span class="link_categories">
        分类：
            <a href="/brave2211/article/category/1593711" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_fenlei']);">Java</a> 
        </span>
    <span class="link_postdate">2014-03-24 01:03</span>
    <span class="link_view" title="阅读次数">13005人阅读</span>
    <span class="link_comments" title="评论次数"><a href="#comments" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_pinglun'])">评论</a>(18)</span>
    <span class="link_collect"><a href="javascript:void(0);" onclick="javascript:_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_shoucang']);collectArticle('深入理解Java Class文件格式（六）','21888943');return false;" title="收藏">收藏</a></span>
    <span class="link_report"><a href="#report"  onclick="javascript:_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_jubao']);report(21888943,2);return false;" title="举报">举报</a></span>
    
</div>
<div class="tag2box"><a href='http://www.csdn.net/tag/class%e6%96%87%e4%bb%b6%e6%a0%bc%e5%bc%8f' target=_blank onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_tag']);">class文件格式</a><a href='http://www.csdn.net/tag/%e5%b8%b8%e9%87%8f%e6%b1%a0' target=_blank onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_tag']);">常量池</a><a href='http://www.csdn.net/tag/this_class' target=_blank onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_tag']);">this_class</a><a href='http://www.csdn.net/tag/super_class' target=_blank onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_tag']);">super_class</a><a href='http://www.csdn.net/tag/interfaces' target=_blank onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_tag']);">interfaces</a></div>

  
    
<div id="article_content" class="article_content">

<p><span style="font-size:14px"><br>
</span></p>
<p><span style="font-size:14px">经过前几篇文章， 终于将常量池介绍完了， 之所以花这么大的功夫介绍常量池， 是因为对于理解class文件&#26684;式，常量池是必须要了解的， 因为class文件中其他地方，大量引用了常量池中的数据项。 &nbsp;对于还不了解常量池的读者， 如果想要深入了解class文件&#26684;式， 或者想继续读这篇博客和本专栏以后的博客， 那么我建议先把我前面的几篇博客读一下，把常量池的结构熟悉一下， 对于理解后面的内容很有帮助。&nbsp;</span></p>
<p><span style="font-size:14px"><br>
</span></p>
<p><span style="font-size:14px">虽然介绍完了常量池， 但是class文件中位于常量池下面的内容还有很多呢。 接下来， 我们就分析class文件中位于常量池下面的内容， 不用担心， 只要把常量池搞明白了， 这些内容就会很容易理解。&nbsp;</span></p>
<p><span style="font-size:14px"><br>
</span></p>
<p><span style="font-size:14px">在开始进入正文之前， 在这里再次给出class文件的整体&#26684;式。 这个表&#26684;曾出现在&nbsp;<a target="_blank" target="_blank" href="http://blog.csdn.net/zhangjg_blog/article/details/21486985">深入理解Java Class文件&#26684;式（一）</a>&nbsp;这篇文章中。 之所以把这个表&#26684;列在这里， 是想再次给读者一个class文件的总体概览。表&#26684;的内容如下：</span></p>
<p>
<table border="1" width="600" cellspacing="0" cellpadding="1" style="color:rgb(0,0,0); font-family:Arial; line-height:26px">
<tbody>
<tr>
<td><strong><span style="font-size:12px">类型</span></strong></td>
<td><strong><span style="font-size:12px">名称</span></strong></td>
<td><strong><span style="font-size:12px">数量</span></strong></td>
</tr>
<tr>
<td><span style="font-size:12px">u4</span></td>
<td><span style="font-size:12px">magic</span></td>
<td><span style="font-size:12px">1</span></td>
</tr>
<tr>
<td><span style="font-size:12px">u2</span></td>
<td><span style="font-size:12px">minor_version</span></td>
<td><span style="font-size:12px">1</span></td>
</tr>
<tr>
<td><span style="font-size:12px">u2</span></td>
<td><span style="font-size:12px">major_version</span></td>
<td><span style="font-size:12px">1</span></td>
</tr>
<tr>
<td><span style="font-size:12px">u2</span></td>
<td><span style="font-size:12px">constant_pool_count</span></td>
<td><span style="font-size:12px">1</span></td>
</tr>
<tr>
<td><span style="font-size:12px">cp_info</span></td>
<td><span style="font-size:12px">constant_pool</span></td>
<td><span style="font-size:12px">constant_pool_count - 1</span></td>
</tr>
<tr>
<td><span style="font-size:12px">u2</span></td>
<td><span style="font-size:12px">access_flags</span></td>
<td><span style="font-size:12px">1</span></td>
</tr>
<tr>
<td><span style="font-size:12px">u2</span></td>
<td><span style="font-size:12px">this_class</span></td>
<td><span style="font-size:12px">1</span></td>
</tr>
<tr>
<td><span style="font-size:12px">u2</span></td>
<td><span style="font-size:12px">super_class</span></td>
<td><span style="font-size:12px">1</span></td>
</tr>
<tr>
<td><span style="font-size:12px">u2</span></td>
<td><span style="font-size:12px">interfaces_count</span></td>
<td><span style="font-size:12px">1</span></td>
</tr>
<tr>
<td><span style="font-size:12px">u2</span></td>
<td><span style="font-size:12px">interfaces</span></td>
<td><span style="font-size:12px">interfaces_count</span></td>
</tr>
<tr>
<td><span style="font-size:12px">u2</span></td>
<td><span style="font-size:12px">fields_count</span></td>
<td><span style="font-size:12px">1</span></td>
</tr>
<tr>
<td><span style="font-size:12px">field_info</span></td>
<td><span style="font-size:12px">fields</span></td>
<td><span style="font-size:12px">fields_count</span></td>
</tr>
<tr>
<td><span style="font-size:12px">u2</span></td>
<td><span style="font-size:12px">methods_count</span></td>
<td><span style="font-size:12px">1</span></td>
</tr>
<tr>
<td><span style="font-size:12px">method_info</span></td>
<td><span style="font-size:12px">methods</span></td>
<td><span style="font-size:12px">methods_count</span></td>
</tr>
<tr>
<td><span style="font-size:12px">u2</span></td>
<td><span style="font-size:12px">attribute_count</span></td>
<td><span style="font-size:12px">1</span></td>
</tr>
<tr>
<td><span style="font-size:12px">attribute_info</span></td>
<td><span style="font-size:12px">attributes</span></td>
<td><span style="font-size:12px">attributes_count<br>
</span></td>
</tr>
</tbody>
</table>
<span style="font-size:14px"><br>
<br>
下面我们就开始介绍class文件中的其他内容。</span></p>
<p><span style="font-size:14px"><br>
</span></p>
<p><span style="font-size:14px"><br>
</span></p>
<p></p>
<h1 style="margin:0px; padding:0px; font-family:Arial; line-height:26px"><span style="font-size:14px">class文件中的访问标志信息</span></h1>
<div><span style="font-size:14px"><br>
</span></div>
<div><span style="font-size:14px"><br>
</span></div>
<div><span style="font-size:14px">从上面的表&#26684;可以看出， 位于常量池下面的2个字节是access_flags 。&nbsp;access_flags 描述的是当前类（或者接口）的访问修饰符， 如public， private等， 此外， 这里面还存在一个标志位， 标志当前的额这个class描述的是类， 还是接口。access_flags 的信息比较简单， 下面列出access_flags 中的各个标志位的信息。本来写这个系列博客参考的是《深入java虚拟机》， 但是这本书比较老了， 关于java
 5以后的新特性没有进行解释，这本书中指列出了5个标志&#20540;， 而最新的JVM规范是针对java 7 的， 其中加入了额外的三个标志位。 分别是ACC_SYNTHETIC， ACC_ANNOTATION 和 ACC_ENUM &nbsp;。</span></div>
<div><span style="font-size:14px"><br>
</span></div>
<div><span style="font-size:14px"><br>
</span>
<table border="1" width="800" cellspacing="0" cellpadding="1">
<tbody>
<tr>
<td><span style="font-size:12px"><strong>标志名</strong><br>
</span></td>
<td><span style="font-size:12px"><strong>标志&#20540;</strong><br>
</span></td>
<td><span style="font-size:12px"><strong>标志含义</strong><br>
</span></td>
<td><span style="font-size:12px"><strong>针对的对像</strong><br>
</span></td>
</tr>
<tr>
<td><span style="font-size:12px">ACC_PUBLIC<br>
</span></td>
<td><span style="font-size:12px">0x0001<br>
</span></td>
<td><span style="font-size:12px">public类型</span></td>
<td><span style="font-size:12px">所有类型</span></td>
</tr>
<tr>
<td><span style="font-size:12px">ACC_FINAL<br>
</span></td>
<td><span style="font-size:12px">0x0010<br>
</span></td>
<td><span style="font-size:12px">final类型</span></td>
<td><span style="font-size:12px">类</span></td>
</tr>
<tr>
<td><span style="font-size:12px">ACC_SUPER<br>
</span></td>
<td><span style="font-size:12px">0x0020<br>
</span></td>
<td><span style="font-size:12px">使用新的invokespecial语义</span></td>
<td><span style="font-size:12px">类和接口</span></td>
</tr>
<tr>
<td><span style="font-size:12px">ACC_INTERFACE<br>
</span></td>
<td><span style="font-size:12px">0x0200<br>
</span></td>
<td><span style="font-size:12px">接口类型</span></td>
<td><span style="font-size:12px">接口</span></td>
</tr>
<tr>
<td><span style="font-size:12px">ACC_ABSTRACT<br>
</span></td>
<td><span style="font-size:12px">0x0400<br>
</span></td>
<td><span style="font-size:12px">抽象类型</span></td>
<td><span style="font-size:12px">类和接口</span></td>
</tr>
<tr>
<td><span style="font-size:12px">ACC_SYNTHETIC<br>
</span></td>
<td><span style="font-size:12px">0x1000</span></td>
<td><span style="font-size:12px">该类不由用户代码生成</span></td>
<td><span style="font-size:12px">所有类型</span></td>
</tr>
<tr>
<td><span style="font-size:12px">ACC_ANNOTATION&nbsp;<br>
</span></td>
<td><span style="font-size:12px">0x2000</span></td>
<td><span style="font-size:12px">注解类型</span></td>
<td><span style="font-size:12px">注解</span></td>
</tr>
<tr>
<td><span style="font-size:12px">ACC_ENUM &nbsp;<br>
</span></td>
<td><span style="font-size:12px">0x4000</span></td>
<td><span style="font-size:12px">枚举类型</span></td>
<td><span style="font-size:12px">枚举</span></td>
</tr>
</tbody>
</table>
<span style="font-size:14px"><br>
<br>
其他标志就不做介绍了， 这些标志都很简单。 读者感觉比较陌生的可能是ACC_SUPER这个标志。 读者会想， 类型不能被super关键字修饰啊， 那这个ACC_SUPER是做什么的呢？表中可以看出，　它的含义是：使用新的invokespecial语义 。&nbsp;invokespecial是一个字节码指令， 用于调用一个方法， 一般情况下， 调用构造方法或者使用super关键字显示调用父类的方法时， 会使用这条字节码指令。 这正是ACC_SUPER这个名字的由来。 在java 1.2之前，&nbsp;invokespecial对方法的调用都是静态绑定的，
 而ACC_SUPER这个标志位在java 1.2的时候加入到class文件中， 它为invokespecial这条指令增加了动态绑定的功能。 这里可能有几个概念读者不是很明白， 如静态绑定， 动态绑定等， 这些概念会在以后的博客中详细介绍。</span></div>
<div><span style="font-size:14px"><br>
</span></div>
<div><span style="font-size:14px">还有一点需要说明， 既然access_flags 出现在class文件中的类的层面上， 那么它只能描述类型的修饰符， 而不能描述字段或方法的修饰符， 希望读者不要将这里的access_flags 和后面要介绍的方法表和字段表中的访问修饰符相混淆。</span></div>
<div><span style="font-size:14px"><br>
</span></div>
<div><span style="font-size:14px">此外， 在Java 5 的中， 引入和注解和枚举的新特性， 那么可以推测，&nbsp;&nbsp;ACC_ANNOTATION 和 ACC_ENUM是在Java 5版本中加入的。 class文件虽然总体上保持前后一致性， 但他也不是一成不变的， 也会跟着Java版本的提升而有所改变， 但是总体来说， class文件&#26684;式还是相对稳定的， 变动的地方不是很多。&nbsp;</span></div>
<div><span style="font-size:14px"><br>
</span></div>
<div><span style="font-size:14px"><br>
</span></div>
<div><span style="font-size:14px"><br>
</span>
<h1 style="margin:0px; padding:0px; font-family:Arial; line-height:26px"><span style="font-size:14px">class文件中的this_class</span></h1>
<span style="font-size:14px"><br>
访问标志access_flags 下面的两个字节叫做<span style="font-family:Arial; line-height:26px">this_class， 它是对当前类的描述。 它的两个字节的数据是对常量池中的一个CONSTANT_Class_info数据项的一个索引。&nbsp;<span style="font-family:Arial; line-height:26px">CONSTANT_Class_info在上面的文章中已经介绍过了。&nbsp;<span style="font-family:Arial; line-height:26px">CONSTANT_Class_info中有一个字段叫做name_index
 ， 指向一个<span style="font-family:Arial; line-height:26px">CONSTANT_Utf8_info ， 在这个<span style="font-family:Arial; line-height:26px">CONSTANT_Utf8_info 中存放着当前类的全限定名。&nbsp;</span></span></span></span></span></span></div>
<div><span style="line-height:26px; font-family:Arial"><span style="font-size:14px"><br>
</span></span></div>
<div><span style="line-height:26px; font-family:Arial"><span style="font-size:14px">如果当前类为Person：</span></span></div>
<div><span style="line-height:26px; font-family:Arial"><span style="font-size:14px"></span></span><pre name="code" class="java">package com.jg.zhang;

public class Person {

	int age;

	int getAge(){
		return age;
	}
}</pre><br>
将Person.class反编译后， 可以在常量池中看到如下两项：</div>
<div><br>
</div>
<div><pre name="code" class="java">  Constant pool:
   #1 = Class              #2             //  com/jg/zhang/Person
   #2 = Utf8               com/jg/zhang/Person
   
.........
.........</pre><br>
<br>
</div>
<div><span style="font-size:14px">这两项就是当前类的信息。 其中索引为1的<span style="font-family:Arial; line-height:26px">CONSTANT_Class_info会被class文件中的this_class所引用。 下面给出示例图<span style="font-family:Arial; line-height:26px">（其中虚线范围内表示常量池的区域）</span>：</span></span></div>
<div><span style="font-size:14px"><span style="font-family:Arial; line-height:26px"><img src="http://img.blog.csdn.net/20140324000705203?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvemhhbmdqZ19ibG9n/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt=""><br>
</span></span></div>
<div><span style="font-size:14px"><span style="font-family:Arial; line-height:26px"><br>
</span></span></div>
<h1 style="margin:0px; padding:0px; font-family:Arial; line-height:26px"><span style="font-size:14px"><br>
</span></h1>
<h1 style="margin:0px; padding:0px; font-family:Arial; line-height:26px"><span style="font-size:14px">class文件中的super_class</span></h1>
<div><span style="font-size:14px"><br>
</span></div>
<div><span style="font-size:14px"><br>
</span></div>
<div><span style="font-size:14px">super_class紧跟在this_class之后。 它和this_class一样是一个指向常量池数据项的索引。 它指向一个<span style="font-family:Arial; line-height:26px">CONSTANT_Class_info， 这个<span style="font-family:Arial; line-height:26px">CONSTANT_Class_info数据项描述的是当前类的超类的信息。<span style="font-family:Arial; line-height:26px">CONSTANT_Class_info中的name_index指向常量池中的一个<span style="font-family:Arial; line-height:26px">CONSTANT_Utf8_info
 ，<span style="font-family:Arial; line-height:26px">CONSTANT_Utf8_info 中存放的是当前类的超类的全限定名。 如果没有显式的继承一个，</span><span style="font-family:Arial; line-height:26px"></span></span></span>也就是说如果当前类是直接继承Object的， 那么super_class&#20540;为0 。 我们在前面的文章中提到过， 如果一个索引&#20540;为0， 那么就说明这个索引不引用任何常量池中的数据项，
 因为常量池中的数据项是从1开始的。 也就是说， 如果一个类的class文件中的super_class为0 ， 那么就代表该类直接继承Object类。&nbsp;</span></span></span></div>
<div><span style="font-size:14px"><span style="font-family:Arial; line-height:26px"><span style="font-family:Arial; line-height:26px"><br>
</span></span></span></div>
<div><span style="font-family:Arial; font-size:14px"><span style="line-height:26px">下面以代码来说明：</span></span></div>
<div><span style="font-family:Arial; font-size:14px"><span style="line-height:26px"></span></span><pre name="code" class="java">package com.jg.zhang;

public class Programer extends Person{

	Computer computer;
	
	public Programer(Computer computer){
		this.computer = computer;
	}
	
	public void doWork(){
		computer.calculate();
	}
}</pre><br>
上面的Programer类继承自Person类。 那么反编译<span style="font-family:Arial; line-height:26px">Programer .class ， 它的常量池中会存在如下信息：</span></div>
<div><span style="font-family:Arial; font-size:14px"><span style="line-height:26px"><span style="font-family:Arial; line-height:26px"></span></span></span><pre name="code" class="java">Constant pool:

.........
.........

   #3 = Class              #4             //  com/jg/zhang/Person
   #4 = Utf8               com/jg/zhang/Person</pre><br>
这两项就是当前类的父类的信息。 其中索引为3的<span style="font-family:Arial; line-height:26px">CONSTANT_Class_info会被class文件中的super_class引用。 下面给出示例图<span style="font-family:Arial; line-height:26px">（其中虚线范围内表示常量池的区域）</span>：</span></div>
<div><span style="font-family:Arial; font-size:14px"><span style="line-height:26px"><span style="font-family:Arial; line-height:26px"><span style="font-family:Arial; line-height:26px"><img src="http://img.blog.csdn.net/20140324002345406?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvemhhbmdqZ19ibG9n/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt=""><br>
</span></span></span></span></div>
<div><span style="font-family:Arial; font-size:14px"><span style="line-height:26px"><span style="font-family:Arial; line-height:26px"><br>
</span></span></span></div>
<div><span style="font-size:14px"><br>
</span></div>
<div>
<h1 style="margin:0px; padding:0px; font-family:Arial; line-height:26px"><span style="font-size:14px"><br>
</span></h1>
<h1 style="margin:0px; padding:0px; font-family:Arial; line-height:26px"><span style="font-size:14px">class文件中的interfaces_count和interfaces</span></h1>
<div><span style="font-size:14px"><br>
</span></div>
<div><span style="font-size:14px"><br>
</span></div>
<div><span style="font-size:14px">紧接着super_class的是<span style="font-family:Arial; line-height:26px">interfaces_count， 表示当前类所实现的接口的数量或者当前接口所继承的超接口的数量。 注意， 只有当前类直接实现的接口才会被统计， 如果当前类继承了另一个类， 而另一个类又实现了一个接口， 那么这个接口不会统计在当前类的<span style="font-family:Arial; line-height:26px">interfaces_count中。
 在<span style="font-family:Arial; line-height:26px">interfaces_count后面是<span style="font-family:Arial; line-height:26px">interfaces， 他可以看做是一个数组， 其中的每个数组项是一个索引， 指向常量池中的一个<span style="font-family:Arial; line-height:26px">CONSTANT_Class_info， 这个<span style="font-family:Arial; line-height:26px">CONSTANT_Class_info又会引用常量池中的一个<span style="font-family:Arial; line-height:26px">CONSTANT_Utf8_info
 ， 这个<span style="font-family:Arial; line-height:26px">CONSTANT_Utf8_info 中存放着有当前类型直接实现或继承的接口的全限定名。 当前类型实现或继承了几个接口， 在<span style="font-family:Arial; line-height:26px">interfaces数组中就会有几个数项与之相对应。&nbsp;</span></span></span></span></span></span></span></span></span></span></div>
<div><span style="font-family:Arial; line-height:26px"><span style="font-family:Arial; line-height:26px"><span style="font-family:Arial; line-height:26px"><span style="font-family:Arial; line-height:26px"><span style="font-family:Arial; line-height:26px"><span style="font-family:Arial; line-height:26px"><span style="font-family:Arial; line-height:26px"><span style="font-family:Arial; line-height:26px"><span style="font-family:Arial; line-height:26px"><span style="font-size:14px"><br>
</span></span></span></span></span></span></span></span></span></span></div>
<div><span style="font-family:Arial; font-size:14px"><span style="line-height:26px">下面看代码示例：</span></span></div>
<div><span style="font-family:Arial; font-size:14px"><span style="line-height:26px"></span></span><pre name="code" class="java">package com.jg.zhang;

public class Plane implements IFlyable, Cloneable{

	@Override
	public void fly() {
		
	}
}</pre><br>
Plane类实现了一个自定义的IFlyable接口， 还实现了一个JDK中的Cloneable接口， 那么它的常量池中会有如下信息：</div>
<div><br>
</div>
<div><pre name="code" class="java">Constant pool:
 
.........
.........

   #5 = Class              #6             //  com/jg/zhang/IFlyable
   #6 = Utf8               com/jg/zhang/IFlyable
   #7 = Class              #8             //  java/lang/Cloneable
   #8 = Utf8               java/lang/Cloneable
   
.........
.........</pre><br>
</div>
<div><span style="font-size:14px"><br>
这四项数据就是当前的<span style="font-family:Arial; line-height:26px">Plane类所实现的接口的信息。 第五项和第六项描述了<span style="font-family:Arial; line-height:26px">Plane所实现的<span style="font-family:Arial; line-height:26px">IFlyable接口， 第七项和第八项描述了<span style="font-family:Arial; line-height:26px">Plane所实现的</span><span style="font-family:Arial; line-height:26px">接口<span style="font-family:Arial; line-height:26px">Cloneable接口。
 下面是示意图（其中虚线范围内表示常量池的区域）：</span></span></span></span></span></span></div>
<div><span style="font-size:14px"><img src="http://img.blog.csdn.net/20140324005003265?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvemhhbmdqZ19ibG9n/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt=""><br>
</span></div>
<div><span style="font-size:14px"><br>
</span></div>
<span style="font-size:14px"><br>
</span></div>
<p><span style="font-size:14px"><br>
</span></p>
<p><span style="font-size:14px"><br>
</span></p>
<h1><span style="font-size:14px">总结</span></h1>
<div><span style="font-size:14px"><br>
</span></div>
<div><span style="font-size:14px">在本篇博客中， 继续讲解了class文件中常量池以下的部分。 主要讲解了三个部分， 分别是this_class ， super_class ， interfaces_count和<span style="font-size:14px">interfaces 。 这三个数据项分别描述了当前类（就是当前class文件所在的类）， 当前类所继承的超类， 和当前类所实现的接口（如果当前class文件代表的是一个接口， 那么<span style="font-size:14px">&nbsp;interfaces_count和</span><span style="font-size:14px">interfaces描述的是当前接口所继承的超接口</span>）。</span></span></div>
<div><span style="font-size:14px"><span style="font-size:14px"><br>
</span></span></div>
<div><span style="font-size:14px">这几个数据项都持有指向常量池的索引。 真实的信息都是存放在常量池中的， 只不过常量池中的这些信息会被<span style="font-size:14px">this_class ， super_class ， interfaces_count和</span><span style="font-size:14px">interfaces 引用。&nbsp;</span></span></div>
<div><span style="font-size:14px"><span style="font-size:14px"><br>
</span></span></div>
<div><span style="font-size:14px">通过本篇博客我们可以知道源文件中的当前类， 当前类的超类以及当前类的超接口在class文件中是如何被描述的。 在下一篇博客中， 将会讲解源文件中的定义的字段， 声明的方法在class文件中是如何描述的。&nbsp;</span></div>
<div><span style="font-size:14px"><br>
</span></div>
<div><span style="font-size:14px"><br>
</span></div>
<div><span style="font-size:14px"><br>
</span></div>
<div><span style="font-size:14px"><br>
</span></div>
<div><span style="font-size:14px"></span>
<p class="cjk" style="margin-bottom:0cm"><span style="font-family:SimHei; color:rgb(255,0,0)"><span style="font-size:14px">更多关于深入理解Java的文章, 请关注我的专栏 :&nbsp;<a target="_blank" target="_blank" href="http://blog.csdn.net/column/details/zhangjg-java-blog.html">http://blog.csdn.net/column/details/zhangjg-java-blog.html</a></span></span></p>
<p class="cjk" style="margin-bottom:0cm"><span style="font-family:SimHei; color:rgb(255,0,0)"><span style="font-size:14px">更多关于Java和Android等其他技术的文章, 请关注我的博客:&nbsp;<a target="_blank" target="_blank" href="http://blog.csdn.net/zhangjg_blog">http://blog.csdn.net/zhangjg_blog</a></span></span></p>
<br>
</div>
<span style="font-size:14px"><br>
</span>
<p></p>

</div>




<!-- Baidu Button BEGIN -->

<div class="bdsharebuttonbox" style="float: right;">
<a href="#" class="bds_more" data-cmd="more" style="background-position:0 0 !important; background-image: url(http://bdimg.share.baidu.com/static/api/img/share/icons_0_16.png?v=d754dcc0.png) !important"></a>
<a href="#" class="bds_qzone" data-cmd="qzone" title="分享到QQ空间"  style="background-position:0 -52px !important"></a>
<a href="#" class="bds_tsina" data-cmd="tsina" title="分享到新浪微博"style="background-position:0 -104px !important"></a>
<a href="#" class="bds_tqq" data-cmd="tqq" title="分享到腾讯微博"style="background-position:0 -260px !important"></a>
<a href="#" class="bds_renren" data-cmd="renren" title="分享到人人网"style="background-position:0 -208px !important"></a>
<a href="#" class="bds_weixin" data-cmd="weixin" title="分享到微信"style="background-position:0 -1612px !important" ></a>
</div>
<script>window._bd_share_config = { "common": { "bdSnsKey": {}, "bdText": "", "bdMini": "1", "bdMiniList": false, "bdPic": "", "bdStyle": "0", "bdSize": "16" }, "share": {} }; with (document) 0[(getElementsByTagName('head')[0] || body).appendChild(createElement('script')).src = 'http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion=' + ~(-new Date() / 36e5)];</script>
<!-- Baidu Button END -->

<!--192.168.100.35-->
<ul class="article_next_prev">
            <li class="prev_article"><span  onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_shangyipian']);location.href='/zhangjg_blog/article/details/21781021';">上一篇</span><a href="/zhangjg_blog/article/details/21781021" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_shangyipian'])">深入理解Java Class文件格式（五）</a></li>
            <li class="next_article"><span onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_xiayipian']);location.href='/zhangjg_blog/article/details/21940559';">下一篇</span><a href="/zhangjg_blog/article/details/21940559" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_xiayipian'])">鲜为人知的编程真相（转）</a></li>
</ul>

<!-- Baidu Button BEGIN -->
<script type="text/javascript" id="bdshare_js" data="type=tools&amp;uid=1536434" ></script>
<script type="text/javascript" id="bdshell_js"></script>
<script type="text/javascript">
    document.getElementById("bdshell_js").src = "http://bdimg.share.baidu.com/static/js/shell_v2.js?cdnversion=" + Math.ceil(new Date()/3600000)
</script>
<!-- Baidu Button END -->


        <div id="digg" ArticleId="21888943">
            <dl id="btnDigg" class="digg digg_disable">
                <dt onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_ding'])">顶</dt>
                <dd>25</dd>
            </dl>
            <dl id="btnBury" class="digg digg_disable">
                <dt onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_cai'])">踩</dt>
                <dd>0</dd>
            </dl>
        </div>
</div>
      <dl class="blog-associat-tag">
        <dt>主题推荐</dt>
        <dd>
                <a href="http://www.csdn.net/tag/java" target="_blank" class="blog-tage-red" >java</a> 
                <a href="http://www.csdn.net/tag/反编译" target="_blank" class="blog-tage-red" >反编译</a> 
                <a href="http://www.csdn.net/tag/interface" target="_blank" class="blog-tage-red" >interface</a> 
                <a href="http://www.csdn.net/tag/虚拟机" target="_blank" class="blog-tage-red" >虚拟机</a> 
                <a href="http://www.csdn.net/tag/object" target="_blank" class="blog-tage-red" >object</a> 
        </dd>
    </dl> 


<dl class="blog-ass-articl tracking-ad"  data-mod="popu_36" id="res-relatived"> 
     <dt><span>猜你在找</span></dt>    
</dl>
<div id="job_blog_reco">
<script src="http://csdnimg.cn/jobreco/job_reco.js" type="text/javascript"></script>
   
     <script type="text/javascript">
         csdn.position.show({
         sourceType: "blog",
         tplType: "blogDetail",
         searchType: "detail",
         searchKey: "21888943",
             username: "",
         containerId: "job_blog_reco"
        }); 
    </script>

</div>

<script type="text/javascript">
    var searchtitletags = '深入理解Java Class文件格式（六）' + ',' + 'java,反编译,interface,虚拟机,object';
    searchService({
        index: 'blog',
        query: searchtitletags,
        from: 10,
        size: 10,
        appendTo: '#res-relatived',
        url: 'recommend',
        his: 2,
        client: "blog_cf_enhance",
        tmpl: '<dd style="background:url(http://static.blog.csdn.net/skin/default/images/blog-dot-red3.gif) no-repeat 0 10px;"><a href="#{ url }" title="#{ title }" strategy="#{ strategy }">#{ title }</a></dd>'
    });

 </script>   



    <div id="ad_cen">
   
          <script type="text/javascript">
              new Ad(4, 'ad_cen');
          </script>
    </div>
<div class="comment_class">
    <div id="comment_title" class="panel_head">
        <span class="see_comment">查看评论</span><a name="comments"></a></div>
    <div id="comment_list">
    </div>
    <div id="comment_bar">
    </div>
    <div id="comment_form">
    </div>

    <div class="announce">
        * 以上用户言论只代表其个人观点，不代表CSDN网站的观点或立场<a name="reply"></a><a name="quote"></a></div>
</div>

<script type="text/javascript">
    var fileName = '21888943';
    var commentscount = 18;
    var islock = false
</script>
<script type="text/javascript" src="http://static.blog.csdn.net/scripts/comment.js"></script>
    <div id="ad_bot">
    </div>
    <script type="text/javascript">
    new Ad(5, 'ad_bot');
    </script>
<div id="report_dialog">
</div>

<div id="d-top"  style="bottom:60px;">
        <a id="quick-reply" class="btn btn-top q-reply" title="快速回复" style="display:none;">
            <img src="http://static.blog.csdn.net/images/blog-icon-reply.png" alt="快速回复">
        </a>    

    <a id="d-top-a" class="btn btn-top backtop"  style="display: none;" title="返回顶部" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_huidaodingbu'])" style="">         
         <img src="http://static.blog.csdn.net/images/top.png" alt="TOP">
    </a>
</div>
<script type="text/javascript">
    $(function ()
    {
        $("#ad_frm_0").height("90px");
        
        setTimeout(function(){
            $("#ad_frm_2").height("200px");
        },1000);
        
        /*
        if($("#comment_content").length>0)
        {
            $("#quick-reply").show();

            $("#quick-reply").click(function(){
                setEditorFocus();
            });
        }       
     
        var d_top = $('#d-top-a');

        document.onscroll = function ()
        {
            var scrTop = (document.body.scrollTop || document.documentElement.scrollTop);
            if (scrTop > 500)
            {
                d_top.show();
            } else
            {
                d_top.hide();
            }
        }
        $('#d-top-a').click(function ()
        {
            scrollTo(0, 0);
            this.blur();
            return false;
        });
        */
    });
  
</script>
<style type="text/css">
    .tag_list
    {
        background: none repeat scroll 0 0 #FFFFFF;
        border: 1px solid #D7CBC1;
        color: #000000;
        font-size: 12px;
        line-height: 20px;
        list-style: none outside none;
        margin: 10px 2% 0 1%;
        padding: 1px;
    }
    .tag_list h5
    {
        background: none repeat scroll 0 0 #E0DBD3;
        color: #47381C;
        font-size: 12px;
        height: 24px;
        line-height: 24px;
        padding: 0 5px;
        margin: 0;
    }
    .tag_list h5 a
    {
        color: #47381C;
    }
    .classify
    {
        margin: 10px 0;
        padding: 4px 12px 8px;
    }
    .classify a
    {
        margin-right: 20px;
        white-space: nowrap;
    }
</style>
<div class="tag_list">
    <h5>
        <a href="http://www.csdn.net/tag/" target="_blank">核心技术类目</a></h5>
    <div class="classify">
<a title="全部主题" href="http://www.csdn.net/tag" target="_blank" onclick="LogClickCount(this,336);">全部主题</a>
<a title="Hadoop" href="http://g.csdn.net/5272865" target="_blank" onclick="LogClickCount(this,336);">Hadoop</a>
<a title="AWS" href="http://g.csdn.net/5272866" target="_blank" onclick="LogClickCount(this,336);">AWS</a>
<a title="移动游戏" href="http://g.csdn.net/5272870" target="_blank" onclick="LogClickCount(this,336);">移动游戏</a>
<a title="Java" href="http://g.csdn.net/5272871" target="_blank" onclick="LogClickCount(this,336);">Java</a>
<a title="Android" href="http://g.csdn.net/5272872" target="_blank" onclick="LogClickCount(this,336);">Android</a>
<a title="iOS" href="http://g.csdn.net/5272873" target="_blank" onclick="LogClickCount(this,336);">iOS</a>
<a title="Swift" href="http://g.csdn.net/5272868" target="_blank" onclick="LogClickCount(this,336);">Swift</a>
<a title="智能硬件" href="http://g.csdn.net/5272869" target="_blank" onclick="LogClickCount(this,336);">智能硬件</a>
<a title="Docker" href="http://g.csdn.net/5272867" target="_blank" onclick="LogClickCount(this,336);">Docker</a>
<a title="OpenStack" href="http://g.csdn.net/5272925" target="_blank" onclick="LogClickCount(this,336);">OpenStack</a>
<a title="VPN" href="http://www.csdn.net/tag/vpn" target="_blank" onclick="LogClickCount(this,336);">VPN</a>
<a title="Spark" href="http://g.csdn.net/5272924" target="_blank" onclick="LogClickCount(this,336);">Spark</a>
<a title="ERP" href="http://www.csdn.net/tag/erp" target="_blank" onclick="LogClickCount(this,336);">ERP</a>
<a title="IE10" href="http://www.csdn.net/tag/ie10" target="_blank" onclick="LogClickCount(this,336);">IE10</a>
<a title="Eclipse" href="http://www.csdn.net/tag/eclipse" target="_blank" onclick="LogClickCount(this,336);">Eclipse</a>
<a title="CRM" href="http://www.csdn.net/tag/crm" target="_blank" onclick="LogClickCount(this,336);">CRM</a>
<a title="JavaScript" href="http://www.csdn.net/tag/javascript" target="_blank" onclick="LogClickCount(this,336);">JavaScript</a>
<a title="数据库" href="http://www.csdn.net/tag/数据库" target="_blank" onclick="LogClickCount(this,336);">数据库</a>
<a title="Ubuntu" href="http://www.csdn.net/tag/ubuntu" target="_blank" onclick="LogClickCount(this,336);">Ubuntu</a>
<a title="NFC" href="http://www.csdn.net/tag/nfc" target="_blank" onclick="LogClickCount(this,336);">NFC</a>
<a title="WAP" href="http://www.csdn.net/tag/wap" target="_blank" onclick="LogClickCount(this,336);">WAP</a>
<a title="jQuery" href="http://www.csdn.net/tag/jquery" target="_blank" onclick="LogClickCount(this,336);">jQuery</a>
<a title="BI" href="http://www.csdn.net/tag/bi" target="_blank" onclick="LogClickCount(this,336);">BI</a>
<a title="HTML5" href="http://www.csdn.net/tag/html5" target="_blank" onclick="LogClickCount(this,336);">HTML5</a>
<a title="Spring" href="http://www.csdn.net/tag/spring" target="_blank" onclick="LogClickCount(this,336);">Spring</a>
<a title="Apache" href="http://www.csdn.net/tag/apache" target="_blank" onclick="LogClickCount(this,336);">Apache</a>
<a title=".NET" href="http://www.csdn.net/tag/.net" target="_blank" onclick="LogClickCount(this,336);">.NET</a>
<a title="API" href="http://www.csdn.net/tag/api" target="_blank" onclick="LogClickCount(this,336);">API</a>
<a title="HTML" href="http://www.csdn.net/tag/html" target="_blank" onclick="LogClickCount(this,336);">HTML</a>
<a title="SDK" href="http://www.csdn.net/tag/sdk" target="_blank" onclick="LogClickCount(this,336);">SDK</a>
<a title="IIS" href="http://www.csdn.net/tag/iis" target="_blank" onclick="LogClickCount(this,336);">IIS</a>
<a title="Fedora" href="http://www.csdn.net/tag/fedora" target="_blank" onclick="LogClickCount(this,336);">Fedora</a>
<a title="XML" href="http://www.csdn.net/tag/xml" target="_blank" onclick="LogClickCount(this,336);">XML</a>
<a title="LBS" href="http://www.csdn.net/tag/lbs" target="_blank" onclick="LogClickCount(this,336);">LBS</a>
<a title="Unity" href="http://www.csdn.net/tag/unity" target="_blank" onclick="LogClickCount(this,336);">Unity</a>
<a title="Splashtop" href="http://www.csdn.net/tag/splashtop" target="_blank" onclick="LogClickCount(this,336);">Splashtop</a>
<a title="UML" href="http://www.csdn.net/tag/uml" target="_blank" onclick="LogClickCount(this,336);">UML</a>
<a title="components" href="http://www.csdn.net/tag/components" target="_blank" onclick="LogClickCount(this,336);">components</a>
<a title="Windows Mobile" href="http://www.csdn.net/tag/windowsmobile" target="_blank" onclick="LogClickCount(this,336);">Windows Mobile</a>
<a title="Rails" href="http://www.csdn.net/tag/rails" target="_blank" onclick="LogClickCount(this,336);">Rails</a>
<a title="QEMU" href="http://www.csdn.net/tag/qemu" target="_blank" onclick="LogClickCount(this,336);">QEMU</a>
<a title="KDE" href="http://www.csdn.net/tag/kde" target="_blank" onclick="LogClickCount(this,336);">KDE</a>
<a title="Cassandra" href="http://www.csdn.net/tag/cassandra" target="_blank" onclick="LogClickCount(this,336);">Cassandra</a>
<a title="CloudStack" href="http://www.csdn.net/tag/cloudstack" target="_blank" onclick="LogClickCount(this,336);">CloudStack</a>
<a title="FTC" href="http://www.csdn.net/tag/ftc" target="_blank" onclick="LogClickCount(this,336);">FTC</a>
<a title="coremail" href="http://www.csdn.net/tag/coremail" target="_blank" onclick="LogClickCount(this,336);">coremail</a>
<a title="OPhone " href="http://www.csdn.net/tag/ophone " target="_blank" onclick="LogClickCount(this,336);">OPhone </a>
<a title="CouchBase" href="http://www.csdn.net/tag/couchbase" target="_blank" onclick="LogClickCount(this,336);">CouchBase</a>
<a title="云计算" href="http://www.csdn.net/tag/云计算" target="_blank" onclick="LogClickCount(this,336);">云计算</a>
<a title="iOS6" href="http://www.csdn.net/tag/iOS6" target="_blank" onclick="LogClickCount(this,336);">iOS6</a>
<a title="Rackspace " href="http://www.csdn.net/tag/rackspace " target="_blank" onclick="LogClickCount(this,336);">Rackspace </a>
<a title="Web App" href="http://www.csdn.net/tag/webapp" target="_blank" onclick="LogClickCount(this,336);">Web App</a>
<a title="SpringSide" href="http://www.csdn.net/tag/springside" target="_blank" onclick="LogClickCount(this,336);">SpringSide</a>
<a title="Maemo" href="http://www.csdn.net/tag/maemo" target="_blank" onclick="LogClickCount(this,336);">Maemo</a>
<a title="Compuware" href="http://www.csdn.net/tag/compuware" target="_blank" onclick="LogClickCount(this,336);">Compuware</a>
<a title="大数据" href="http://www.csdn.net/tag/大数据" target="_blank" onclick="LogClickCount(this,336);">大数据</a>
<a title="aptech" href="http://www.csdn.net/tag/aptech" target="_blank" onclick="LogClickCount(this,336);">aptech</a>
<a title="Perl" href="http://www.csdn.net/tag/perl" target="_blank" onclick="LogClickCount(this,336);">Perl</a>
<a title="Tornado" href="http://www.csdn.net/tag/tornado" target="_blank" onclick="LogClickCount(this,336);">Tornado</a>
<a title="Ruby" href="http://www.csdn.net/tag/ruby" target="_blank" onclick="LogClickCount(this,336);">Ruby</a>
<a title="Hibernate" href="http://www.csdn.net/hibernate" target="_blank" onclick="LogClickCount(this,336);">Hibernate</a>
<a title="ThinkPHP" href="http://www.csdn.net/tag/thinkphp" target="_blank" onclick="LogClickCount(this,336);">ThinkPHP</a>
<a title="HBase" href="http://www.csdn.net/tag/hbase" target="_blank" onclick="LogClickCount(this,336);">HBase</a>
<a title="Pure" href="http://www.csdn.net/tag/pure" target="_blank" onclick="LogClickCount(this,336);">Pure</a>
<a title="Solr" href="http://www.csdn.net/tag/solr" target="_blank" onclick="LogClickCount(this,336);">Solr</a>
<a title="Angular" href="http://www.csdn.net/tag/angular" target="_blank" onclick="LogClickCount(this,336);">Angular</a>
<a title="Cloud Foundry" href="http://www.csdn.net/tag/cloudfoundry" target="_blank" onclick="LogClickCount(this,336);">Cloud Foundry</a>
<a title="Redis" href="http://www.csdn.net/tag/redis" target="_blank" onclick="LogClickCount(this,336);">Redis</a>
<a title="Scala" href="http://www.csdn.net/tag/scala" target="_blank" onclick="LogClickCount(this,336);">Scala</a>
<a title="Django" href="http://www.csdn.net/tag/django" target="_blank" onclick="LogClickCount(this,336);">Django</a>
<a title="Bootstrap" href="http://www.csdn.net/tag/bootstrap" target="_blank" onclick="LogClickCount(this,336);">Bootstrap</a>
    </div>
</div>

<div id="pop_win" style="display:none ;position: absolute; z-index: 10000; border: 1px solid rgb(220, 220, 220); top: 222.5px; left: 630px; opacity: 1; background: none 0px 0px repeat scroll rgb(255, 255, 255);">
    
</div>
<div id="popup_mask"></div>
<style>
    #popup_mask
    {
        position: absolute;
        width: 100%;
        height: 100%;
        background: #000;
        z-index: 9999;
        left: 0px;
        top: 0px;
        opacity: 0.3;
        filter: alpha(opacity=30);
        display: none;
    }

</style>




<script type="text/javascript">
    $(function(){
        setTimeout(function(){
            $(".comment_body:contains('回复')").each(function(index,item){
                var u=$(this).text().split('：')[0].toString().replace("回复","")
                var thisComment=$(this);
                if(u)
                {
                    $.getJSON("https://passport.csdn.net/get/nick?callback=?", {users: u}, function(a) {
                        if(a!=null&&a.data!=null&&a.data.length>0)
                        {
                            nick=a.data[0].n; 
                            if(u!=nick)
                            {
                                thisComment.text(thisComment.text().replace(u,nick));  
                            }
                        }       
                    });  
                }
            });
        },200);  
        
        setTimeout(function(){
            $("a img[src='http://js.tongji.linezing.com/stats.gif']").parent().css({"position":"absolute","left":"50%"});
        },300);
    });

    function loginbox(){
        var $logpop=$("#pop_win");
        $logpop.html('<iframe src="https://passport.csdn.net/account/loginbox?service=http://static.blog.csdn.net/callback.htm" frameborder="0" height="600" width="400" scrolling="no"></iframe>');

        $('#popup_mask').css({
            opacity: 0.5,
            width: $( document ).width() + 'px',
            height:  $( document ).height() + 'px'
        });
        $('#popup_mask').css("display","block");
 
        $logpop.css( {
            top: ($( window ).height() - $logpop.height())/ 2  + $( window 
       ).scrollTop() + 'px',
            left:($( window ).width() - $logpop.width())/ 2
        } );
 
        setTimeout( function () {
            $logpop.show();
            $logpop.css( {
                opacity: 1
            } );
        }, 200 );
 
        $('#popup_mask').unbind("click");
        $('#popup_mask').bind("click", function(){
            $('#popup_mask').hide();
            var $clopop = $("#pop_win");
            $("#common_ask_div_sc").css("display","none");
            $clopop.css( {
                opacity: 0
            } );
            setTimeout( function () {
                $clopop.hide();
            }, 350 );
            return false;
        });
    }    

</script>
                        <div class="clear">
                        </div>
                    </div>                   
                
            </div>
            <div id="side">
    <div class="side">
<div id="panel_Profile" class="panel">
<ul class="panel_head"><span>个人资料</span></ul>
<ul class="panel_body profile">
<div id="blog_userface">
    <a href="http://my.csdn.net/brave2211" target="_blank">
    <img src="http://avatar.csdn.net/B/2/6/1_brave2211.jpg" title="访问我的空间" style="max-width:90%"/>
    </a>
    <br />
    <span><a href="http://my.csdn.net/brave2211" class="user_name" target="_blank">brave2211</a></span>
</div>
<div class="interact">
<a href="javascript:void(0);" class="attent" id="span_add_follow" title="[加关注]" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_guanzhu'])"></a>

 <a href="javascript:void(0);" class="letter"  title="[发私信]" onclick="window.open('http://msg.csdn.net/letters/model?receiver=brave2211','_blank','height=350,width=700');_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_sixin'])"></a>  
</div>
<div id="blog_medal">
                <div id="bms_box">
                                            <a  target="_blank">
                                                    <img src="http://csdnimg.cn/jifen/images/xunzhang/xunzhang/zhuanlandaren.png" onmouseover="m_over_m(this,2)" onmouseout="m_out_m()" alt="2" >
                                            </a>
               </div>
</div>
<ul id="blog_rank">
    <li>访问：<span>155239次</span></li>
    <li>积分：<span>2867</span> </li>    
    <li >等级： <span style="position:relative;display:inline-block;z-index:1" >
            <img src="http://csdnimg.cn/jifen/images/xunzhang/jianzhang/blog5.png" alt="" style="vertical-align: middle;" id="leveImg">
            <div id="smallTittle" style=" position: absolute;  left: -24px;  top: 25px;  text-align: center;  width: 101px;  height: 32px;  background-color: #fff;  line-height: 32px;  border: 2px #DDDDDD solid;  box-shadow: 0px 2px 2px rgba (0,0,0,0.1);  display: none;   z-index: 999;">
            <div style="left: 42%;  top: -8px;  position: absolute;  width: 0;  height: 0;  border-left: 10px solid transparent;  border-right: 10px solid transparent;  border-bottom: 8px solid #EAEAEA;"></div>
            积分：2867 </div>
        </span>  </li>
    <li>排名：<span>第4742名</span></li>
</ul>
<ul id="blog_statistics">
    <li>原创：<span>60篇</span></li>
    <li>转载：<span>7篇</span></li>
    <li>译文：<span>2篇</span></li>
    <li>评论：<span>534条</span></li>
</ul>
</ul>
</div>


<div class="panel" id="panel_Search">
    <ul class="panel_head"><span>文章搜索</span></ul>
    <ul class="panel_body">
        <form id="frmSearch" action="http://so.csdn.net/search" class="form_search" target="_blank">
        <span><input id="inputSearch" type="text" class="blogsearch" title="请输入关键字" /></span>
        <input id="btnSubmit" type="button" value="搜索" title="search in blog" />
        <input type="hidden" name="q" id="inputQ" />
        <input type="hidden" name="t" value="blog" />
        <a id="btnSearchBlog" target="_blank"></a>
        </form>
    </ul>
</div>

<script type="text/javascript">
    $(function () {
        $("#btnSubmit").click(function () {           
            search();
        });

        $("#frmSearch").submit(function () {
            search();
            return false;
        });

        function search()
        {
            var url = "http://so.csdn.net/so/search/s.do?q=" + encodeURIComponent($("#inputSearch").val()) + "&u=" + username + "&t=blog";
            window.location.href = url;
        }   
    });
</script><div id="panel_Category" class="panel">
    <ul class="panel_head"><span>博客专栏</span></ul>
    <ul class="panel_body" id="sp_column">
    <table cellpadding="0" cellspacing="0"><tr>
    <td style="padding:10px 10px 0 0;">
    <a href="http://blog.csdn.net/column/details/zhangjg-java-blog.html" target="_blank"><img src="http://avatar.csdn.net/blogpic/20140303170404593.jpg" style="width:75px;height:75px;" /></a>
    </td>
    <td style="padding:10px 0; vertical-align:top;">
    <a href="http://blog.csdn.net/column/details/zhangjg-java-blog.html" target="_blank">深入理解Java语言</a>
    <p>文章：19篇</p>
    <span>阅读：63106</span>
    </td>
    </tr></table>
    </ul>
</div>
<div id="panel_Category" class="panel">
<ul class="panel_head"><span>文章分类</span></ul>
<ul class="panel_body">
             <li>
                <a href="http://blog.csdn.net/zhangjg_blog/article/category/1593709" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">Android</a><span>(23)</span>
            </li>
             <li>
                <a href="http://blog.csdn.net/zhangjg_blog/article/category/1593711" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">Java</a><span>(26)</span>
            </li>
             <li>
                <a href="http://blog.csdn.net/zhangjg_blog/article/category/1705525" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">程序人生</a><span>(8)</span>
            </li>
             <li>
                <a href="http://blog.csdn.net/zhangjg_blog/article/category/1748897" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">数据库</a><span>(4)</span>
            </li>
             <li>
                <a href="http://blog.csdn.net/zhangjg_blog/article/category/1833961" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">Python</a><span>(1)</span>
            </li>
             <li>
                <a href="http://blog.csdn.net/zhangjg_blog/article/category/1851495" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">设计模式与架构</a><span>(5)</span>
            </li>
             <li>
                <a href="http://blog.csdn.net/zhangjg_blog/article/category/1854561" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">Ruby</a><span>(0)</span>
            </li>
             <li>
                <a href="http://blog.csdn.net/zhangjg_blog/article/category/1875841" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">Go</a><span>(2)</span>
            </li>
             <li>
                <a href="http://blog.csdn.net/zhangjg_blog/article/category/1882591" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">Linux</a><span>(3)</span>
            </li>
             <li>
                <a href="http://blog.csdn.net/zhangjg_blog/article/category/1882593" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">网络</a><span>(0)</span>
            </li>
             <li>
                <a href="http://blog.csdn.net/zhangjg_blog/article/category/2141245" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">scala</a><span>(6)</span>
            </li>
             <li>
                <a href="http://blog.csdn.net/zhangjg_blog/article/category/2305241" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">C/C++</a><span>(1)</span>
            </li>
</ul>
</div>

<div id="custom_column_30144049" class="panel">
<ul class="panel_head"><span>友情链接</span></ul>
<ul class="panel_body">

<a href="http://weibo.com/u/2797560530/home?wvr=5" target="_blank"><font color="red">我的微博</font></a>
<p>QQ: 523901846</p>

</ul>
</div><div id="panel_Archive" class="panel">
<ul class="panel_head"><span>文章存档</span></ul>
<ul class="panel_body">
<div id="archive_list">
<!--归档统计-->
<li><a href="http://blog.csdn.net/zhangjg_blog/article/month/2014/12">2014年12月</a><span>(1)</span></li><li><a href="http://blog.csdn.net/zhangjg_blog/article/month/2014/10">2014年10月</a><span>(3)</span></li><li><a href="http://blog.csdn.net/zhangjg_blog/article/month/2014/06">2014年06月</a><span>(4)</span></li><li><a href="http://blog.csdn.net/zhangjg_blog/article/month/2014/05">2014年05月</a><span>(3)</span></li><li><a href="http://blog.csdn.net/zhangjg_blog/article/month/2014/04">2014年04月</a><span>(9)</span></li><li><a href="http://blog.csdn.net/zhangjg_blog/article/month/2014/03">2014年03月</a><span>(14)</span></li><li><a href="http://blog.csdn.net/zhangjg_blog/article/month/2014/02">2014年02月</a><span>(7)</span></li><li><a href="http://blog.csdn.net/zhangjg_blog/article/month/2014/01">2014年01月</a><span>(9)</span></li><li><a href="http://blog.csdn.net/zhangjg_blog/article/month/2013/12">2013年12月</a><span>(4)</span></li><li><a href="http://blog.csdn.net/zhangjg_blog/article/month/2013/11">2013年11月</a><span>(7)</span></li><li><a href="http://blog.csdn.net/zhangjg_blog/article/month/2013/10">2013年10月</a><span>(4)</span></li><li><a href="http://blog.csdn.net/zhangjg_blog/article/month/2013/09">2013年09月</a><span>(2)</span></li><li><a href="http://blog.csdn.net/zhangjg_blog/article/month/2013/08">2013年08月</a><span>(2)</span></li>
</div>
</ul>
</div>
<div id="hotarticls" class="panel">
<ul class="panel_head">
    <span>       
阅读排行    </span>
</ul>

<ul class="panel_body itemlist">
<li>
<a href="/zhangjg_blog/article/details/21888943" title="深入理解Java Class文件格式（六）">深入理解Java Class文件格式（六）</a><span>(12999)</span>
</li>
<li>
<a href="/zhangjg_blog/article/details/18735243" title="一个示例让你明白适配器模式">一个示例让你明白适配器模式</a><span>(8391)</span>
</li>
<li>
<a href="/zhangjg_blog/article/details/10901293" title="Android系统中标准Intent的使用">Android系统中标准Intent的使用</a><span>(8037)</span>
</li>
<li>
<a href="/zhangjg_blog/article/details/20380971" title="深入理解Java虚拟机到底是什么">深入理解Java虚拟机到底是什么</a><span>(5671)</span>
</li>
<li>
<a href="/zhangjg_blog/article/details/17621339" title="我为什么要学习Linux?">我为什么要学习Linux?</a><span>(5670)</span>
</li>
<li>
<a href="/zhangjg_blog/article/details/21486985" title="深入理解Java Class文件格式（一）">深入理解Java Class文件格式（一）</a><span>(5648)</span>
</li>
<li>
<a href="/zhangjg_blog/article/details/10923643" title="Android中Activity四种启动模式和taskAffinity属性详解">Android中Activity四种启动模式和taskAffinity属性详解</a><span>(5429)</span>
</li>
<li>
<a href="/zhangjg_blog/article/details/19996629" title="深入理解为什么Java中方法内定义的内部类可以访问方法中的局部变量">深入理解为什么Java中方法内定义的内部类可以访问方法中的局部变量</a><span>(5350)</span>
</li>
<li>
<a href="/zhangjg_blog/article/details/10431649" title="Android开发中adb命令的常用方法">Android开发中adb命令的常用方法</a><span>(5339)</span>
</li>
<li>
<a href="/zhangjg_blog/article/details/17142395" title="Android中build target，minSdkVersion，targetSdkVersion，maxSdkVersion概念区分">Android中build target，minSdkVersion，targetSdkVersion，maxSdkVersion概念区分</a><span>(5150)</span>
</li>
</ul>
</div>
<div id="hotarticls2" class="panel">
<ul class="panel_head"><span>评论排行</span></ul>
<ul class="panel_body itemlist">
<li>
<a href="/zhangjg_blog/article/details/17621339" title="我为什么要学习Linux?">我为什么要学习Linux?</a><span>(81)</span>
</li>
<li>
<a href="/zhangjg_blog/article/details/20380971" title="深入理解Java虚拟机到底是什么">深入理解Java虚拟机到底是什么</a><span>(52)</span>
</li>
<li>
<a href="/zhangjg_blog/article/details/18735243" title="一个示例让你明白适配器模式">一个示例让你明白适配器模式</a><span>(47)</span>
</li>
<li>
<a href="/zhangjg_blog/article/details/18953983" title="程序员的困惑">程序员的困惑</a><span>(44)</span>
</li>
<li>
<a href="/zhangjg_blog/article/details/19996629" title="深入理解为什么Java中方法内定义的内部类可以访问方法中的局部变量">深入理解为什么Java中方法内定义的内部类可以访问方法中的局部变量</a><span>(37)</span>
</li>
<li>
<a href="/zhangjg_blog/article/details/18319521" title="Java中的String为什么是不可变的？ -- String源码分析">Java中的String为什么是不可变的？ -- String源码分析</a><span>(21)</span>
</li>
<li>
<a href="/zhangjg_blog/article/details/21888943" title="深入理解Java Class文件格式（六）">深入理解Java Class文件格式（六）</a><span>(18)</span>
</li>
<li>
<a href="/zhangjg_blog/article/details/18369201" title="详解Java中的clone方法 -- 原型模式">详解Java中的clone方法 -- 原型模式</a><span>(16)</span>
</li>
<li>
<a href="/zhangjg_blog/article/details/19193671" title="Android上实现仿IOS弹性ScrollView">Android上实现仿IOS弹性ScrollView</a><span>(14)</span>
</li>
<li>
<a href="/zhangjg_blog/article/details/22455899" title="Class文件格式总结">Class文件格式总结</a><span>(14)</span>
</li>
</ul>
</div>
<div id="homepageArticles" class="panel tracking-ad" data-mod="popu_4">
<ul class="panel_head"><span>推荐文章</span></ul>
<ul class="panel_body" id="ad_commend"></ul>
</div>
<script type="text/javascript">
 new Ad(12, 'ad_commend');
</script><div id="newcomments" class="panel">
<ul class="panel_head"><span>最新评论</span></ul>
<ul class="panel_body itemlist">
    <li>
   
         <a href="/zhangjg_blog/article/details/18369201#comments">详解Java中的clone方法 -- 原型模式</a>
    <p style="margin:0px;"><a href="/ooppookid" class="user_name">ooppookid</a>:
又看了一遍，楼主的配图非常清楚，而且直观，对于不了解编程的人也能明白~，肯定是花了时间去整理的，赞一...
    </p>
    </li>
    <li>
   
         <a href="/zhangjg_blog/article/details/18369201#comments">详解Java中的clone方法 -- 原型模式</a>
    <p style="margin:0px;"><a href="/ooppookid" class="user_name">ooppookid</a>:
java不能直接获取对象或者变量的内存地址，这就是它和c++的区别。String直接用==比较也不是...
    </p>
    </li>
    <li>
   
         <a href="/zhangjg_blog/article/details/17142395#comments">Android中build target，minSdkVersion，targetSdkVersion，maxSdkVersion概念区分</a>
    <p style="margin:0px;"><a href="/azx2008" class="user_name">azx2008</a>:
博主文中提到&quot;一般情况下，应该使用最新的API level作为build target。这也是ecl...
    </p>
    </li>
    <li>
   
         <a href="/zhangjg_blog/article/details/18953983#comments">程序员的困惑</a>
    <p style="margin:0px;"><a href="/guanweiliang" class="user_name">guanweiliang</a>:
和楼主同年毕业，看后真是惭愧
    </p>
    </li>
    <li>
   
         <a href="/zhangjg_blog/article/details/19193671#comments">Android上实现仿IOS弹性ScrollView</a>
    <p style="margin:0px;"><a href="/u011367679" class="user_name">u011367679</a>:
在两端拉动后，不释放，然后向相反方向拉动，此时松手，回弹后的界面是超出了子控件的不是刚好在底部。怎么...
    </p>
    </li>
    <li>
   
         <a href="/zhangjg_blog/article/details/22455899#comments">Class文件格式总结</a>
    <p style="margin:0px;"><a href="/yitengtongweishi" class="user_name">yitengtongweishi</a>:
大神，菜鸟走过，膜拜一下。
    </p>
    </li>
    <li>
   
         <a href="/zhangjg_blog/article/details/20000769#comments">深入理解Java中为什么内部类可以访问外部类的成员</a>
    <p style="margin:0px;"><a href="/u010850027" class="user_name">u010850027</a>:
谢谢分享 学习了`(*∩_∩*)′
    </p>
    </li>
    <li>
   
         <a href="/zhangjg_blog/article/details/19996629#comments">深入理解为什么Java中方法内定义的内部类可以访问方法中的局部变量</a>
    <p style="margin:0px;"><a href="/u010850027" class="user_name">u010850027</a>:
谢谢分享 学习了`(*∩_∩*)′
    </p>
    </li>
    <li>
   
         <a href="/zhangjg_blog/article/details/10923643#comments">Android中Activity四种启动模式和taskAffinity属性详解</a>
    <p style="margin:0px;"><a href="/learningloong" class="user_name">learningloong</a>:
写得很不错，排版也不错，就是有些无伤大雅的小错误，稍微指出一下：有几个 MianActivity 要...
    </p>
    </li>
    <li>
   
         <a href="/zhangjg_blog/article/details/10923643#comments">Android中Activity四种启动模式和taskAffinity属性详解</a>
    <p style="margin:0px;"><a href="/IWSo920" class="user_name">IWSo920</a>:
写的非常清晰，详细。感谢！另外指出一处错误：“五 本文小结”上面“framework中的判定过程”的...
    </p>
    </li>
</ul>
</div>
    </div>
    <div class="clear">
    </div>
</div>

            <div class="clear">
            </div>
        </div>
        

<script type="text/javascript" src="http://csdnimg.cn/rabbit/cnick/cnick.js"></script>
<script type="text/javascript" src="http://static.blog.csdn.net/scripts/newblog.min.js"></script>


<script type="text/javascript" src="http://medal.blog.csdn.net/showblogmedal.ashx?blogid=1600281"></script>
<script type="text/javascript" src="http://static.blog.csdn.net/scripts/JavaScript1.js"></script>

    <script type="text/javascript" src="http://passport.csdn.net/content/loginbox/login.js"></script>
<script type="text/javascript">document.write("<img src=http://counter.csdn.net/pv.aspx?id=24 border=0 width=0 height=0>");</script>
<script type="text/javascript" src="http://www.csdn.net/ui/scripts/Csdn/counter.js"></script>
<script type="text/javascript" src="http://ad.csdn.net/scripts/ad-blog.js"></script>
<script type="text/javascript" src="http://zz.csdn.net/js/count.js"></script>
<script type="text/javascript">
    $(function () {
        function __get_code_toolbar(snippet_id) {
            return $("<a href='https://code.csdn.net/snippets/"
                    + snippet_id
                    + "' target='_blank' title='在CODE上查看代码片' style='text-indent:0;'><img src='https://code.csdn.net/assets/CODE_ico.png' width=12 height=12 alt='在CODE上查看代码片' style='position:relative;top:1px;left:2px;'/></a>"
                    + "<a href='https://code.csdn.net/snippets/"
                    + snippet_id
                    + "/fork' target='_blank' title='派生到我的代码片'  style='text-indent:0;'><img src='https://code.csdn.net/assets/ico_fork.svg' width=12 height=12 alt='派生到我的代码片' style='position:relative;top:2px;left:2px;'/></a>");
        }
        
        $("[code_snippet_id]").each(function () {
            __s_id = $(this).attr("code_snippet_id");
            if (__s_id != null && __s_id != "" && __s_id != 0 && parseInt(__s_id) > 70020) {
                __code_tool = __get_code_toolbar(__s_id);
                $(this).prev().find(".tools").append(__code_tool);
            }
        });
    });
</script>

    </div>
      <!--new top-->
    
    <script id="csdn-toolbar-id" btnId="header_notice_num" wrapId="note1" count="5" subCount="5" type="text/javascript" src="http://static.csdn.net/public/common/toolbar/js/toolbar.js"></script>     <!--new top-->
   
    <link href="http://csdnimg.cn/comm_ask/css/ask_float_block.css" type="text/css" rel="stylesheet" />
    <script language='JavaScript' type='text/javascript' src='http://csdnimg.cn/comm_ask/js/libs/wmd.js'></script>
    <script language='JavaScript' type='text/javascript' src='http://csdnimg.cn/comm_ask/js/libs/showdown.js'></script>
    <script language='JavaScript' type='text/javascript' src='http://csdnimg.cn/comm_ask/js/libs/prettify.js'></script>
    <script language='JavaScript' type='text/javascript' src='http://csdnimg.cn/comm_ask/js/apps/ask_float_block.js'></script>

</body>
</html>
